package com.linser.gistools.common.datastore.model;


import java.util.List;
/**
 * @author: linser
 * @Desc: 表信息
 * @create: 2024-01-28 20:31
 **/
public class DataTableModel {
    String tableName;
    List<FieldModel> fieldModelLst;
    //List<SindaIndexModel> indexModelLst;
    boolean canIndexTable = true;
    boolean candelTable = true;
    boolean isSpatial = false;
    protected BaseDataStoreModel parentStore;
    protected String sldBody;
    protected String sldPath;
    protected Integer srsCode;

//    protected SindaSldEditorNode sindaSldEditorNode;

    public DataTableModel(BaseDataStoreModel Info) {
        this.parentStore = Info;
    }

    public Integer getSrsCode() {
        if (this.srsCode == null) {
            synchronized(this) {
                if (this.srsCode == null) {
                    this.srsCode = this.parentStore.getTableEpsgCode(this.getTableName());
                }
            }
        }

        return this.srsCode;
    }

    public void setSrsCode(Integer srsCode) {
        this.srsCode = srsCode;
    }

    public String getTableName() {
        return this.tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public List<FieldModel> getFieldModelLst() {
        if (this.fieldModelLst == null) {
            synchronized(this) {
                if (this.fieldModelLst == null) {
                    this.fieldModelLst = this.parentStore.getTableField(this.getTableName());
                }
            }
        }

        return this.fieldModelLst;
    }

    public void setFieldModelLst(List<FieldModel> fieldModelLst) {
        this.fieldModelLst = fieldModelLst;
    }


    public boolean isCanIndexTable() {
        return this.canIndexTable;
    }

    public void setCanIndexTable(boolean canIndexTable) {
        this.canIndexTable = canIndexTable;
    }

    public boolean isCandelTable() {
        return this.candelTable;
    }

    public void setCandelTable(boolean candelTable) {
        this.candelTable = candelTable;
    }

    public boolean getIsSpatial() {
        return this.isSpatial;
    }

    public void setSpatial(boolean spatial) {
        this.isSpatial = spatial;
    }

    public BaseDataStoreModel getParentStore() {
        return this.parentStore;
    }

    public void setParentStore(BaseDataStoreModel parentStore) {
        this.parentStore = parentStore;
    }

    public String getSldBody() {
        return this.sldBody;
    }

    public void setSldBody(String sldBody) {
        this.sldBody = sldBody;
    }

    public String getSldPath() {
        return this.sldPath;
    }

    public void setSldPath(String sldPath) {
        this.sldPath = sldPath;
    }

    public String toString() {
        return this.getTableName();
    }


    public boolean delSelf() {
        return this.getParentStore().delTable(this.getTableName());
    }

}
